package com.yixun.qfbao.hander;

import com.yixun.qfbao.api.service.RecommendCompanyService;
import com.yixun.qfbao.api.service.WeAppFormIdService;
import com.yixun.qfbao.apidto.AddWeAppFormIdReqDto;
import com.yixun.qfbao.apidto.AddWeAppFormIdResDto;
import com.yixun.qfbao.dto.base.BaseRequestDTO;
import com.yixun.qfbao.dto.base.BaseResponseDTO;
import com.yixun.qfbao.hander.base.CommonAbstractHander;
import com.yixun.qfbao.service.WeappFormidService;
import com.yixun.qfbao.vo.AddWeAppFormIdReqVo;
import com.yixun.qfbao.xf.model.enums.ResultEnum;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * 添加小程序FormId
 * @author jhsong
 *
 */
@Service("addWeAppFormIdHander")
public class AddWeAppFormIdHander extends CommonAbstractHander {
	private static Logger logger= LoggerFactory.getLogger(AddWeAppFormIdHander.class);

	@Autowired
	private WeAppFormIdService weAppFormIdService;

	@Override
	public BaseResponseDTO doBusiness(BaseRequestDTO reqDto) {
		AddWeAppFormIdReqVo req = (AddWeAppFormIdReqVo)reqDto;
		AddWeAppFormIdReqDto reqDto1 = req.getParams();
		BaseResponseDTO<AddWeAppFormIdResDto> res = new BaseResponseDTO<>();
		AddWeAppFormIdResDto resDto = new AddWeAppFormIdResDto();
		try {
            resDto = weAppFormIdService.addFormId(reqDto1);
			res.setResult(resDto.getResult());
		}catch(Exception e) {
			logger.error("AddWeAppFormIdHander error: {}", e);
			resDto.setResult(ResultEnum.FAIL.getNo());
			resDto.setResultMsg("系统异常");
		}
		res.setResult(resDto.getResult());
		return res;
	}

}
